﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using ChinaUnicom.ViewModels;

namespace ChinaUnicom.Views
{
    public partial class ClientInfoPage : PhoneApplicationPage
    {
        ClientInformationContext InformationContext { get { return DataContext as ClientInformationContext; } }

        public ClientInfoPage()
        {
            InitializeComponent();
            Loaded += OnPageLoaded;
        }

        void OnPageLoaded(object sender, RoutedEventArgs e)
        {
            DataContext = new ClientInformationContext();
        }

        private void OnClientPulled(object sender, EventArgs e)
        {
            InformationContext.ClientPullrefresh = "松开刷新";
        }

        private void OnClientReleased(object sender, EventArgs e)
        {
            InformationContext.ForceUpdateClient();
            InformationContext.ClientPullrefresh = "下拉可以刷新";
        }
        
        private void OnBackClick(object sender, EventArgs e)
        {
            NavigationService.GoBack();
        }
    }
}